﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerBloodController : MonoBehaviour {
    public static PlayerBloodController con;
    public void Awake()
    {
        con = this;
    }

    public RectTransform bloodPre;

    public int maxBlood;

    public int nowblood;

    public void SetMaxBlood(int value)
    {
        nowblood = maxBlood = value;
        for (int i = 0; i < maxBlood; i++)
        {
            Instantiate(bloodPre, transform);
        }
    }

    public void SetBlood()
    {
        Transform child = transform.GetChild(0);
        Destroy(child.gameObject);
        nowblood--;
        if (nowblood==0)
        {
            scenes2Ui.ui.ShowGameOverPanel();
        }
    }
    // Use this for initialization
    void Start () {
        SetMaxBlood(3);
    }
	
	// Update is called once per frame
	void Update () {
		
	}
}
